/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.sacc.pojos;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Fabio
 */
@Entity
@Table(name = "sacc0003")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Sacc0003.findAll", query = "SELECT s FROM Sacc0003 s"),
    @NamedQuery(name = "Sacc0003.findByIdpermiso", query = "SELECT s FROM Sacc0003 s WHERE s.idpermiso = :idpermiso"),
    @NamedQuery(name = "Sacc0003.findByUrl", query = "SELECT s FROM Sacc0003 s WHERE s.url = :url"),
    @NamedQuery(name = "Sacc0003.findByIcono", query = "SELECT s FROM Sacc0003 s WHERE s.icono = :icono"),
    @NamedQuery(name = "Sacc0003.findByFechaalta", query = "SELECT s FROM Sacc0003 s WHERE s.fechaalta = :fechaalta"),
    @NamedQuery(name = "Sacc0003.findByFechabaja", query = "SELECT s FROM Sacc0003 s WHERE s.fechabaja = :fechabaja"),
    @NamedQuery(name = "Sacc0003.findByFechamodificacion", query = "SELECT s FROM Sacc0003 s WHERE s.fechamodificacion = :fechamodificacion"),
    @NamedQuery(name = "Sacc0003.findByEstado", query = "SELECT s FROM Sacc0003 s WHERE s.estado = :estado"),
    @NamedQuery(name = "Sacc0003.findByPermiso", query = "SELECT s FROM Sacc0003 s WHERE s.permiso = :permiso"),
    @NamedQuery(name = "Sacc0003.findByOpcion", query = "SELECT s FROM Sacc0003 s WHERE s.opcion = :opcion"),
    @NamedQuery(name = "Sacc0003.findByAccion", query = "SELECT s FROM Sacc0003 s WHERE s.accion = :accion"),
    @NamedQuery(name = "Sacc0003.findByDescripcion", query = "SELECT s FROM Sacc0003 s WHERE s.descripcion = :descripcion")})
public class Sacc0003 implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idpermiso")
    private Integer idpermiso;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 128)
    @Column(name = "url")
    private String url;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 128)
    @Column(name = "icono")
    private String icono;
    @Basic(optional = false)
    @NotNull
    @Column(name = "fechaalta")
    @Temporal(TemporalType.DATE)
    private Date fechaalta;
    @Column(name = "fechabaja")
    @Temporal(TemporalType.DATE)
    private Date fechabaja;
    @Column(name = "fechamodificacion")
    @Temporal(TemporalType.DATE)
    private Date fechamodificacion;
    @Basic(optional = false)
    @NotNull
    @Column(name = "estado")
    private char estado;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "permiso")
    private String permiso;
    @Basic(optional = false)
    @NotNull
    @Column(name = "opcion")
    private char opcion;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 128)
    @Column(name = "accion")
    private String accion;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 128)
    @Column(name = "descripcion")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "sacc0003")
    private List<Sacc0004> sacc0004List;
    @OneToMany(mappedBy = "relacion")
    private List<Sacc0003> sacc0003List;
    @JoinColumn(name = "relacion", referencedColumnName = "idpermiso")
    @ManyToOne
    private Sacc0003 relacion;

    public Sacc0003() {
    }

    public Sacc0003(Integer idpermiso) {
        this.idpermiso = idpermiso;
    }

    public Sacc0003(Integer idpermiso, String url, String icono, Date fechaalta, char estado, String permiso, char opcion, String accion, String descripcion) {
        this.idpermiso = idpermiso;
        this.url = url;
        this.icono = icono;
        this.fechaalta = fechaalta;
        this.estado = estado;
        this.permiso = permiso;
        this.opcion = opcion;
        this.accion = accion;
        this.descripcion = descripcion;
    }

    public Integer getIdpermiso() {
        return idpermiso;
    }

    public void setIdpermiso(Integer idpermiso) {
        this.idpermiso = idpermiso;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getIcono() {
        return icono;
    }

    public void setIcono(String icono) {
        this.icono = icono;
    }

    public Date getFechaalta() {
        return fechaalta;
    }

    public void setFechaalta(Date fechaalta) {
        this.fechaalta = fechaalta;
    }

    public Date getFechabaja() {
        return fechabaja;
    }

    public void setFechabaja(Date fechabaja) {
        this.fechabaja = fechabaja;
    }

    public Date getFechamodificacion() {
        return fechamodificacion;
    }

    public void setFechamodificacion(Date fechamodificacion) {
        this.fechamodificacion = fechamodificacion;
    }

    public char getEstado() {
        return estado;
    }

    public void setEstado(char estado) {
        this.estado = estado;
    }

    public String getPermiso() {
        return permiso;
    }

    public void setPermiso(String permiso) {
        this.permiso = permiso;
    }

    public char getOpcion() {
        return opcion;
    }

    public void setOpcion(char opcion) {
        this.opcion = opcion;
    }

    public String getAccion() {
        return accion;
    }

    public void setAccion(String accion) {
        this.accion = accion;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    @XmlTransient
    public List<Sacc0004> getSacc0004List() {
        return sacc0004List;
    }

    public void setSacc0004List(List<Sacc0004> sacc0004List) {
        this.sacc0004List = sacc0004List;
    }

    @XmlTransient
    public List<Sacc0003> getSacc0003List() {
        return sacc0003List;
    }

    public void setSacc0003List(List<Sacc0003> sacc0003List) {
        this.sacc0003List = sacc0003List;
    }

    public Sacc0003 getRelacion() {
        return relacion;
    }

    public void setRelacion(Sacc0003 relacion) {
        this.relacion = relacion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idpermiso != null ? idpermiso.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sacc0003)) {
            return false;
        }
        Sacc0003 other = (Sacc0003) object;
        if ((this.idpermiso == null && other.idpermiso != null) || (this.idpermiso != null && !this.idpermiso.equals(other.idpermiso))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.sacc.controlador.util.Sacc0003[ idpermiso=" + idpermiso + " ]";
    }
    
}
